﻿using Aribaccio;
using BDPAutodetect.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BDPAutodetect.Hardware
{
    public class DeviceHelper : Singleton<DeviceHelper>
    {
        /// <summary>
        /// 获取开关寄存器值
        /// </summary>
        /// <param name="argSwitchType">开关类型</param>
        /// <returns></returns>
        public ushort GetSwitchData(SwitchType argSwitchType)
        {
            //(FF 00:打开；00 00：关闭)
            switch (argSwitchType)
            {
                case SwitchType.On:
                    return 0xFF00;
                case SwitchType.Off:
                default:
                    return 0x0000;
            }
        }

        /// <summary>
        /// 获取开关类型
        /// </summary>
        /// <param name="argSwitchData">开关寄存器值</param>
        /// <returns></returns>
        public SwitchType GetSwitchType(ushort argSwitchData)
        {
            if (argSwitchData == 0xFF00)
                return SwitchType.On;
            else
                return SwitchType.Off;
        }
    }
}
